class Solution(object):
    def findContentChildren(self, g, s):
        """
        :type g: List[int]
        :type s: List[int]
        :rtype: int
        """
        g = sorted(g)
        s = sorted(s)

        j = 0
        num = 0
        for i in range(len(g)):
            #找到符合条件的饼干
            while j < len(s) and g[i] > s[j]:   
                j += 1
            
            if j == len(s):
                return num
            num += 1
            j += 1
        return num
